<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>异步组件加载</title>
</head>
<body>
    <div id="app">
        <APP></APP>
    </div>
    <script src="vue.js"></script>

    <script type='module'>
       
        const App={
            data(){
                return{
                    isShow:false 
                }
            },
            methods:{
                asyncLoad(){
                    this.isShow=!this.isShow;
                }
            },
            components:{
                Test:()=>import('./Test.js')
            },
            template:`
                <div>
                    <button @click='asyncLoad'>异步加载</button> 
                    <Test v-if='isShow'></Test>   
                </div>
            `
        }
        new Vue({
            el:'#app',
            data:{

            },
            components:{
                App
            }
        })
    </script>
</body>
</html>